package io.kiki.sba.registry.common.model.metaserver;

import com.google.common.base.Objects;
import io.kiki.sba.registry.common.model.Node.NodeType;
import lombok.Getter;
import lombok.Setter;

@Setter
@Getter
public class OperationInfo {
    private NodeType nodeType;

    private String cell;

    private String address;

    private long operateTs;

    public OperationInfo() {
    }

    public OperationInfo(NodeType nodeType, String cell, String address, long operateTs) {
        this.nodeType = nodeType;
        this.cell = cell;
        this.address = address;
        this.operateTs = operateTs;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        OperationInfo that = (OperationInfo) o;
        return nodeType == that.nodeType && Objects.equal(cell, that.cell) && Objects.equal(address, that.address);
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(nodeType, cell, address);
    }


}
